<template>
	<view>
		<view class="inputs_info">
			<view class="ipt">
				<input v-model="params.title" @confirm='inputs' class="inputs" confirm-type="search" type="text" placeholder="输入展会标题" />
				<uni-icons type="search" size="24" color="#888888"></uni-icons>
			</view>
		</view>
		<view class="content">
			<view class="cont_flex" v-for="(item,index) in TradeList" :key="index" @click="goPage(item)">
				<image class="flex_l" :src="item.headImage" mode=""></image>
				<view class="flex_r">
					<view class="tit">
						{{item.title}}
					</view>
					<view class="time">
						发布时间：{{item.createTime}}
					</view>
				</view>
			</view>
			<uni-load-more v-if="!TradeList.length <= 0" :status="statusshow"></uni-load-more>
		</view>
		<kong v-if="TradeList.length <= 0"></kong>
	</view>
</template>

<script>
	import { getTradeList} from '@/common/http.api.js';
	export default {
		data() {
			return {
				params:{
					pageNum: 1,
					pageSize: 5,
					title:''
				},
				TradeList:[],
				statusshow:'loading'
			};
		},
		onLoad() {
			this.getList()
		},
		methods:{
			inputs(e){
				this.TradeList = []
				this.params = {
					pageNum: 1,
					pageSize: 5,
					title:e.detail.value
				}
				this.getList()
			},
			getList(){
				getTradeList(this.params).then(res=>{
					if(res.code == 200){
						this.TradeList.push(...res.rows)
						if(this.TradeList.length == res.total){
							this.statusshow = 'no-more'
						}
					}
				})
			},
			onReachBottom(){
				this.params.pageNum ++ 
				this.getList()
			},
			goPage(item){
				uni.navigateTo({
					url:`/pages/exhibition/exhibitionInfo?id=${item.id}`
				})
			}
		}
	}
</script>

<style lang="less">
	page {
		background-color: #F0F0F1;
	}
	.content{
		width: 716rpx;
		margin: 20rpx auto;
		.cont_flex{
			display: flex;
			justify-content: space-between;
			align-items: center;
			background-color: #fff;
			border-radius: 20rpx;
			padding: 34rpx 24rpx;
			box-sizing: border-box;
			margin-bottom: 20rpx;
			.flex_l{
				width: 200rpx;
				height: 160rpx;
				border-radius: 20rpx;
			}
			.flex_r{
				flex: 1;
				margin-left: 10rpx;
				.tit{
					font-size: 28rpx;
					color: #000;
				}
				.time{
					font-size: 24rpx;
					color: #666666;
					margin: 20rpx 0rpx;
				}
			}
		}
	}
</style>
